<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <h2>链式调用</h2>
    <script src="./lib/axios.js"></script>
    <script>
      //  resolve   reject (形参) 名字可以改,但是建议别改
      const p = new Promise((resolve, reject) => {
        setTimeout(() => {
          resolve('1')
        }, 1000)
      })
      console.log(p);
      // const result=p
      p
      .then(res =>{
        console.log(res)
        return new Promise((resolve, reject) => {
          setTimeout(() => {
            resolve('2')
          }, 1000)
        })
      })
      .then(res =>{
        console.log(res);
        return new Promise((resolve, reject) => {
          setTimeout(() => {
            resolve('3')
          }, 1000)
        })
      })
      .then(res =>{
        console.log(res);
      })
      // console.log(result);
    </script>
  </body>
</html>
